export default {
  namespaced:true,
  state:{
    attr:{
      width:375,
      height:667,
    },
    newList:{}, //当前移动参数
    content:[],
    ghostClass:"" //设置拖动元素的占位符类名
  },
  mutations:{
    saveNewList(state,value){
      state.newList = value
    },
    saveContent(state,res){
      let oldIndex = res.oldIndex
      let newIndex = res.newIndex
      let newContent = state.content.find(e=>e.index == newIndex)
      if(oldIndex != undefined){ // 替换模式
        let oldContent = state.content.find(e=>e.index == oldIndex)
        newContent.index = oldIndex
        oldContent.index = newIndex
      }else{ // 新增模式
        state.content.push(res.element)
      }
    },
    setGhostClass(state,value){
      console.log(value)
      state.ghostClass = value
    }
  },
  actions:{

  }
}